{{ $versions := index .Site.Data.docs.pages .Params.docname }}
<a class="dropdown-trigger" id="reference-versions-trigger" data-panel-id="previous-versions-dropdown" href="#">
  {{ if (and (isset .Params "version") (ne .Params.version (index $versions "latest-changes"))) }}
    Version {{ .Params.version }}
  {{ else }}
    Latest version
  {{ end }} ▾ </a>
<span class="light d-flex">{{ .Params.docname }} last updated in {{ index $versions "latest-changes" }}</span>
<div class='dropdown-panel left' id='previous-versions-dropdown'>
  <header>Changes in the <strong>{{ .Params.docname }}</strong> manual</header>
  <ol class='reference-previous-versions'>
    {{ range $v := index $versions "page-versions" }}
      {{ if $v.added }}
        <li>
        <a href="{{ relURL (print "docs/" $.Params.docname "/" $v.name) }}"><span class="version">{{ $v.name }}</span>
          <span class="diff">
            {{ range $i := seq 1 $v.added }}
              <img src="{{ relURL "images/icons/green-dot.png" }}" />
            {{ end }}
            {{ range $i := seq 1 $v.removed }}
              <img src="{{ relURL "images/icons/red-dot.png" }}" />
            {{ end }}
            {{ range $i := seq 1 (sub 8 $v.added $v.removed) }}
              <img src="{{ relURL "images/icons/grey-dot.png" }}" />
            {{ end }}
          </span>
          <em class="date">{{ index (index $.Site.Data.docs.versions $v.name) "date" }}</em>
        </a>
        </li>
      {{ else }}
        <li class="no-change"><span>{{ safeHTML $v.name }} no changes</span></li>
      {{ end }}
    {{ end }}
    <li>&nbsp;</li>
    <!-- <li><a class="more" href="#">See more previous releases →</a></li> -->
  </ol>
  <footer>
    <p>Check your version of git by running</p>
    <code class="command">git --version</code>
  </footer>
</div>
